/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;

/**
 *
 * @author mrbao
 */
public class Title {

    private String title;
    private int width;
    private Font font;

    public Title(String title, int width) {
        this.title = title;
        this.width = width;
        font = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
    }

    public void Paint(Graphics g) {
        Gradient.DrawGradientBox(g, 0, 0, width, font.getHeight());
        g.setFont(font);
        g.setColor(0xffffff);
        g.drawString(title, (width - font.stringWidth(title)) / 2, 0, 0);
    }
}
